Built-in Functions

Course- Python >

Functions that come built into the Python language itself are called built-in functions and are readily available to us. Functions like print(), input(), eval() etc. that we have been using, are some examples of the built-in function. There are 68 built-in functions (may change with version) in Python. They are listed below alphabetically along with a brief description.

Python built-in functions
Built-in Function Description
abs() Return the absolute value of a number.
all() Return True if all elements of the iterable are true (or if the iterable is empty).
any() Return True if any element of the iterable is true. If the iterable is empty, return False.
ascii() Return a string containing a printable representation of an object, but escape the non-ASCII characters.
bin() Convert an integer number to a binary string.
bool() Convert a value to a Boolean.
bytearray() Return a new array of bytes.
bytes() Return a new "bytes" object.
callable() Return True if the object argument appears callable, False if not.
chr() Return the string representing a character.
classmethod() Return a class method for the function.
compile() Compile the source into a code or AST object.
complex() Create a complex number or convert a string or number to a complex number.
delattr() Deletes the named attribute of an object.
dict() Create a new dictionary.
dir() Return the list of names in the current local scope.
divmod() Return a pair of numbers consisting of quotient and remainder when using integer division.
enumerate() Return an enumerate object.
eval() The argument is parsed and evaluated as a Python expression.
exec() Dynamic execution of Python code.
filter() Construct an iterator from elements of iterable for which function returns true.
float() Convert a string or a number to floating point.
format() Convert a value to a "formatted" representation.
frozenset() Return a new frozenset object.
getattr() Return the value of the named attribute of an object.
globals() Return a dictionary representing the current global symbol table.
hasattr() Return True if the name is one of the object's attributes.
hash() Return the hash value of the object.
help() Invoke the built-in help system.
hex() Convert an integer number to a hexadecimal string.
id() Return the "identity" of an object.
input() Reads a line from input, converts it to a string (stripping a trailing newline), and returns that.
int() Convert a number or string to an integer.
isinstance() Return True if the object argument is an instance.
issubclass() Return True if class is a subclass.
iter() Return an iterator object.
len() Return the length (the number of items) of an object.
list() Return a list.
locals() Update and return a dictionary representing the current local symbol table.
map() Return an iterator that applies function to every item of iterable, yielding the results.
max() Return the largest item in an iterable.
memoryview() Return a "memory view" object created from the given argument.
min() Return the smallest item in an iterable.
next() Retrieve the next item from the iterator.
object() Return a new featureless object.
oct() Convert an integer number to an octal string.
open() Open file and return a corresponding file object.
ord() Return an integer representing the Unicode.
pow() Return power raised to a number.
print() Print objects to the stream.
property() Return a property attribute.
range() Return an iterable sequence.
repr() Return a string containing a printable representation of an object.
reversed() Return a reverse iterator.
round() Return the rounded floating point value.
set() Return a new set object.
setattr() Assigns the value to the attribute.
slice() Return a slice object.
sorted() Return a new sorted list.
staticmethod() Return a static method for function.
str() Return a str version of object.
sum() Sums the items of an iterable from left to right and returns the total.
super() Return a proxy object that delegates method calls to a parent or sibling class.
tuple() Return a tuple
type() Return the type of an object.
vars() Return the __dict__ attribute for a module, class, instance, or any other object.
zip() Make an iterator that aggregates elements from each of the iterables.
__import__() This function is invoked by the import statement.